package unseen;

public class test2 {
    public static void walk(Running running) {

        running.run();
    }
    public static void main(String[] args) {
        System.out.println("我带着伙伴去散步");
        Rabbit rabbit=new Rabbit("小白兔");
        Bear bear=new Bear("小熊");
        walk(bear);
        walk(rabbit);

    }
}
interface Running{
    void run();
}
class Rabbit implements Running{
    public String name;
    public Rabbit(String name){
        this.name=name;
    }
    public void run(){
        System.out.println(name+"正在跳着跑");
    }
}
class Bear implements Running{
    public String name;
    public Bear(String name){
        this.name=name;
    }
    public void run(){
        System.out.println(name+"正在用四只腿跑");
    }
}